﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Runtime.Serialization;
using Json = Newtonsoft.Json;
using System.IO;
using System.Runtime.Serialization.Json;
using Newtonsoft.Json;

namespace XAPI.Domain
{
    [DataContract()]
    public class Statement
    {
        #region Private
        //public JsonSerializerSettings Settings { get; private set; }
        #endregion

        #region Constructors
        public Statement()
        {
            //this.Settings = new JsonSerializerSettings
            //{
            //    ReferenceLoopHandling = ReferenceLoopHandling.Error
            //};
        }
        #endregion

        #region Public Properties
        [DataMember]
        public Guid id { get; set; }

        [DataMember(EmitDefaultValue = false)]
        public Actor actor { get; set; }

        [DataMember(EmitDefaultValue = false)]
        public Verb verb { get; set; }

        [DataMember(EmitDefaultValue = false, Name = "object")]
        public dynamic xObject { get; set; }

        [DataMember(EmitDefaultValue = false)]
        public Result result { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public Context context { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public DateTime timestamp { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public DateTime stored { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public Authority authority { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public XVersion version { get; set; }

        //[DataMember(EmitDefaultValue = false)]
        //public List<Attachment> attachments { get; set; }

        [Obsolete]
        [DataMember(EmitDefaultValue = false)]
        public bool? inProgress { get; set; }

        [Obsolete]
        [DataMember(EmitDefaultValue = false)]
        public bool? voided { get; set; }
        #endregion

        #region Public Methods

        //public override string ToString()
        //{
        //    var scriptSerializer = JsonSerializer.Create(this.Settings);

        //    using (var sw = new StringWriter())
        //    {
        //        scriptSerializer.Serialize(sw, this);
        //        return sw.ToString();
        //    }
        //}
        #endregion
    }
}